package com.yonyou.pmclouds.organization.mapper;

import com.yonyou.pmclouds.basecom.dao.BaseMapper;
import com.yonyou.pmclouds.organization.entity.OrganizationVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface OrganizationMapper extends BaseMapper<OrganizationVO> {

    OrganizationVO[] getOrgByTenant(@Param("pkTenant") String pkTenant, @Param("enableState") Integer enableState, @Param("keyword") String keyword);

    @Select("select pk_organization, scode, sname, pk_parent, pk_src, change_flag from pm_organization where pk_tenant = #{pkTenant} and scode in (${scodes}) and dr = 0 order by scode")
    OrganizationVO[] getOrgByCode(@Param("pkTenant") String pkTenant, @Param("scodes") String scodes);

    @Select("select pk_organization, scode, sname, pk_parent, pk_src, change_flag,enable_state from pm_organization where pk_tenant = #{pkTenant} and pk_src in (${pkSrcs}) and dr = 0 order by scode")
    OrganizationVO[] queryByPkSrcs(@Param("pkTenant") String pkTenant, @Param("pkSrcs") String pkSrcs);

    @Select("select pk_organization, scode, sname, pk_parent, pk_src, change_flag,enable_state from pm_organization where pk_tenant = #{pkTenant} and pk_organization in (${pkOrgs}) and dr = 0 order by scode")
    OrganizationVO[] queryByPkOrgs(@Param("pkTenant") String pkTenant, @Param("pkOrgs") String pkOrgs);

    OrganizationVO[] queryByIds(@Param("ids") String[] ids);
}
